/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.ByteArrayInputStream;
/*    */ import java.io.ByteArrayOutputStream;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class SetActiveSyncDisabled
/*    */   extends RedoableOp
/*    */ {
/*    */   private int folderId;
/*    */   private boolean disableActiveSync;
/*    */   
/*    */   public SetActiveSyncDisabled()
/*    */   {
/* 35 */     super(MailboxOperation.SetDisableActiveSync);
/*    */   }
/*    */   
/*    */   public SetActiveSyncDisabled(int mailboxId, int folderId, boolean disableActiveSync) {
/* 39 */     this();
/* 40 */     setMailboxId(mailboxId);
/* 41 */     this.folderId = folderId;
/* 42 */     this.disableActiveSync = disableActiveSync;
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException
/*    */   {
/* 47 */     this.folderId = in.readInt();
/* 48 */     this.disableActiveSync = in.readBoolean();
/*    */   }
/*    */   
/*    */   protected String getPrintableData()
/*    */   {
/* 53 */     StringBuffer sb = new StringBuffer("id=").append(this.folderId);
/* 54 */     sb.append(", disableActiveSync=" + (this.disableActiveSync ? "TRUE" : "FALSE"));
/* 55 */     return sb.toString();
/*    */   }
/*    */   
/*    */   public void redo() throws Exception
/*    */   {
/* 60 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 61 */     mbox.setActiveSyncDisabled(getOperationContext(), this.folderId, this.disableActiveSync);
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException
/*    */   {
/* 66 */     out.writeInt(this.folderId);
/* 67 */     out.writeBoolean(this.disableActiveSync);
/*    */   }
/*    */   
/*    */   byte[] testSerialize()
/*    */     throws IOException
/*    */   {
/* 73 */     ByteArrayOutputStream out = new ByteArrayOutputStream();
/* 74 */     serializeData(new RedoLogOutput(out));
/* 75 */     return out.toByteArray();
/*    */   }
/*    */   
/*    */   void testDeserialize(byte[] data) throws IOException {
/* 79 */     deserializeData(new RedoLogInput(new ByteArrayInputStream(data)));
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/SetActiveSyncDisabled.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */